let vm = null;

const sendThis = (_this) => {
  console.log(_this, 'vm')
  vm = _this;
};
export default {
  sendThis,
  batchColumns: [{
    type: 'index',
    width: 100,
    title: '序号',
    align: 'center',
  },
  {
    title: '批次名称',
    key: 'batchName',
    minWidth: 120,
  },
  {
    title: '证件类型',
    key: 'certType',
    minWidth: 100,
    render(h, params) {
      return h(
        'div',
        vm.$formatter.switchName('certTypeList', params.row.certType)
      )
    },
  },
  {
    title: '证件编号',
    key: 'certCode',
    minWidth: 120,
  },
  {
    title: '开盘时间',
    key: 'firstOpenTime',
    minWidth: 120,
    render(h, params) {
      return params.row.certType == 2 ?
        '无' :
        h('div', params.row.firstOpenTime)
    },
  },
  {
    title: '操作',
    key: 'operation',
    minWidth: 180,
    align: 'center',
    fixed: 'right',
    render: (h, params) => {
      return h('div', [
        h(
          'a', {
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.associatedBatch(params.row) //点击事件
              },
            },
          },
          '关联该批次'
        ),
      ])
    },
  }, ],

  columnList: [{
    type: 'selection',
    width: 60,
    align: 'center',
    fixed: 'left',
  },
  {
    title: '全选',
    type: 'index',
    minWidth: 100,
  },
  {
    title: '楼栋号',
    key: 'buildingName',
    minWidth: 120,
  },
  {
    title: '建筑类型',
    key: 'buildingType',
    minWidth: 120,
    render(h, params) {
      return h(
        'div',
        params.row.buildingType &&
        vm.buildingArr.filter(
          (item) => item.key == params.row.buildingType
        ) ?
        vm.buildingArr.filter(
          (item) => item.key == params.row.buildingType
        )[0].value :
        ''
      )
    },
  },
  {
    title: '是否建模',
    key: 'isModeled',
    minWidth: 120,
    render(h, params) {
      return h('div', params.row.isModeled ? '已建模' : '未建模')
    },
  },
  {
    title: '是否开售',
    key: 'status',
    minWidth: 120,
    // render(h, params) {
    //   return h('div', params.row.isOpenSell ? '已开售' : '未开售')
    // },
    render: (h, params) => {
      return h('div', [
        h(
          'span', {
            style: {
              color: params.row.status == 'REJECT' ?
                'red' : params.row.status == 'WAIT_APPROVE' ?
                '#2d8cf0' : '#515a6e',
              cursor: params.row.status == 'REJECT' ?
                'pointer' : params.row.status == 'WAIT_APPROVE' ?
                'pointer' : 'default',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.getExamineDetails(params.row, 'status') //点击事件
              },
            },
          },
          // params.row.isOpenSell ? '已开售' : '未开售'
          vm.$formatter.switchName('buildingStatus', params.row.status)
        ),
      ])
    },
  },
  {
    title: '开盘批次',
    key: 'batchName',
    minWidth: 150,
    render: (h, params) => {
      return h('div', [
        h(
          'span', {
            style: {
              display: params.row.batchName ? 'inline-block' : 'none',
              width: 'calc(100% - 30px)',
              overflow: 'hidden',
              textOverflow: 'ellipsis',
              whiteSpace: 'nowrap',
            },
            domProps: {
              title: params.row.batchName,
            },
          },
          params.row.batchName
        ),
        h(
          'span', {
            style: {
              color: vm.unlocking('0103020400') ? '#2d8cf0' : '#c5c8ce',
              cursor: vm.unlocking('0103020400') ?
                'pointer' : 'not-allowed',
              display:
                !params.row.isOpenSell &&
                !params.row.batchName &&
                params.row.isModeled ?
                'inline-block' : 'none',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.unlocking('0103020400') &&
                  vm.goOpeningBatch(params.row) //点击事件
              },
            },
          },
          '关联批次'
        ),
        h(
          'span', {
            style: {
              color: vm.unlocking('0103020500') ? '#2d8cf0' : '#c5c8ce',
              cursor: vm.unlocking('0103020500') ?
                'pointer' : 'not-allowed',

              marginLeft: '10px',

              verticalAlign: 'top',
              margin: 0,
              display:
                !params.row.isOpenSell &&
                params.row.batchName &&
                params.row.isModeled &&
                params.row.status != 'CAN' ?
                'inline-block' : 'none',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.unlocking('0103020500') &&
                  vm.goOpeningBatch(params.row) //点击事件
              },
            },
          },
          '修改'
        ),
      ])
    },
  },
  {
    title: '开盘日期',
    key: 'firstOpenTime',
    minWidth: 120,

    render: (h, params) => {
      return h('div', [
        h(
          'span', {
            style: {
              color: params.row.recId != null ? '#2d8cf0' : '#515a6e',
              cursor: params.row.recId != null ? 'pointer' : 'default',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.getExamineDetails(params.row, 'date') //点击事件
              },
            },
          },
          params.row.firstOpenTime ? params.row.firstOpenTime : '-'
        ),
      ])
    },
  },
  {
    title: '操作',
    key: 'operation',
    minWidth: 180,
    align: 'center',
    fixed: 'right',
    render: (h, params) => {
      return h('div', [
        h(
          'a', {
            style: {
              color: vm.unlocking('0103020900') ? '#2d8cf0' : '#c5c8ce',
              cursor: vm.unlocking('0103020900') ?
                'pointer' : 'not-allowed',
              marginLeft: '10px',
              display: params.row.isModeled ? 'inline-block' : 'none',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.unlocking('0103020900') &&
                  vm.searchHouse(params.row) //点击事件
              },
            },
          },
          '查看房源'
        ),
        h(
          'a', {
            style: {
              color: vm.unlocking('0103020600') ? '#2d8cf0' : '#c5c8ce',
              cursor: vm.unlocking('0103020600') ?
                'pointer' : 'not-allowed',
              marginLeft: '10px',
              display: !params.row.isModeled ? 'inline-block' : 'none',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.unlocking('0103020600') &&
                  vm.searchHouse(params.row) //点击事件
              },
            },
          },
          '创建房源'
        ),
        h(
          'a', {
            style: {
              marginLeft: '10px',
              color: vm.unlocking('0103020700') ? '#2d8cf0' : '#c5c8ce',
              cursor: vm.unlocking('0103020700') ?
                'pointer' : 'not-allowed',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.unlocking('0103020700') &&
                  vm.editBuildingClick(params.row) //点击事件
              },
            },
          },
          '编辑'
        ),
        h(
          'a', {
            style: {
              color: vm.unlocking('0103020800') ? '#2d8cf0' : '#c5c8ce',
              cursor: vm.unlocking('0103020800') ?
                'pointer' : 'not-allowed',
              marginLeft: '10px',
              display: params.row.status == 'CAN' ||
                params.row.status == 'WAIT_APPROVE' ||
                params.row.status == 'APPROVED' ?
                'none' : 'inline-block',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.unlocking('0103020800') &&
                  vm.deleteBuildFun(params.row) //点击事件
              },
            },
          },
          '删除'
        ),
      ])
    },
  }, ],
  productInfoList: [{
    key: 'coopMode',
    name: '合作模式',
    type: 'key',
    arrKey: 'cooperationModeAttrSort',
  },
  {
    key: 'sellMode',
    name: '销售模式',
    type: 'key',
    arrKey: 'salesModel',
  },
  {
    key: 'productType',
    name: '产品类型',
    type: 'key',
    arrKey: 'productType',
  },
  {
    key: 'buildingTypesName',
    name: '建筑类型',
    type: 'key',
    arrKey: 'cooperationModeAttrSort',
  },
  {
    key: 'decorateSituation',
    name: '装修情况',
    type: 'key',
    arrKey: 'productRenovation',
  },
  {
    key: 'property',
    name: '产权年限',
    type: 'text',
    unit: '年',
    arrKey: '',
  },
  {
    key: 'isJumpCommission',
    name: '是否有跳帕佣金',
    type: 'boolean',
    arrKey: '',
  },
  {
    key: 'commissionFeesType',
    name: '代理费',
    type: '',
    arrKey: '',
  },
  {
    key: 'totalCargoQuantityCount',
    name: '总货量(套数)',
    type: 'text',
    unit: '套数',
    arrKey: '',
  }, {
    key: 'totalCargoQuantityArea',
    name: '总货量(面积)',
    type: 'text',
    unit: '㎡',
    arrKey: '',
  }, {
    key: 'totalCargoQuantityValue',
    name: '总货值(价值)',
    type: 'text',
    unit: '元',
    arrKey: '',
  }, {
    key: 'unitCargoQuantityCount',
    name: '单边货量(套数)',
    type: 'text',
    unit: '套数',
    arrKey: '',
  }, {
    key: 'unitCargoQuantityArea',
    name: '单边货量(面积)',
    type: 'text',
    unit: '㎡',
    arrKey: '',
  }, {
    key: 'unitCargoQuantityValue',
    name: '单边货值(价值)',
    type: 'text',
    unit: '元',
    arrKey: '',
  },
  {
    key: 'propertyCompany',
    name: '物业公司',
    type: 'text',
    arrKey: '',
  },
  {
    key: 'propertyFree',
    name: '物业费',
    type: 'text',
    unit: '元/㎡',
    arrKey: '',
  },
  {
    key: 'isIndexCal',
    name: '月末指标计算',
    type: 'boolean',
    arrKey: '',
  }, {
    key: 'generationCompany',
    name: '联代公司简称',
    type: 'text',
    arrKey: '',
  }, ],

}